Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Immediate Rendering callback #592

Merged
merged 1 commit into from Sep 30, 2011
Merged

Immediate Rendering callback #592

merged 1 commit into from Sep 30, 2011

Conversation

NINE78
Copy link
Contributor

@NINE78 NINE78 commented Sep 28, 2011

Added "lower level" immediate rendering functionality. The existing mechanism requires modification of the WebGLRenderer for different objects. The new implementation leaves the current MarchingCubes immediate renderer intact but checks for existence of a immediateRenderCallback member function of the object. If found, that object is added to the scene.__webglObjectsImmediate array. The program, webgl context, and frustum are currently passed into the callback, putting al rendering responsibility at the implementing object. This may break the Three.js abstraction somewhat, but allows "power users" to do some funky webgl stuff while still relying on the Three.js framework for the rest of the scene...

…echanism requires modification of the WebGLRenderer for different objects. The new implementation leaves the current MarchingCubes immediate renderer intact but checks for existence of a immediateRenderCallback member function of the object. If found, that object is added to the scene.__webglObjectsImmediate array. The program, webgl context, and frustum are currently passed into the callback, putting al rendering responsibility at the implementing object. This may break the Three.js abstraction somewhat, but allows "power users" to do some funky webgl stuff while still relying on the Three.js framework for the rest of the scene...
@525c1e21-bd67-4735-ac99-b4b0e5262290
Copy link
Contributor

FYI this should resolve both #548 and #586

@mrdoob
Copy link
Owner

mrdoob commented Sep 30, 2011

@alteredq: is it good to merge then? this goes a bit over my head right now :)

@alteredq
Copy link
Contributor

I guess so, this is still very early stage of such feature, we'll put it in and see where it'll go (usual procedure - collect enough use cases and keep refactoring).

@mrdoob mrdoob merged commit c311a71 into mrdoob:dev Sep 30, 2011
@mrdoob
Copy link
Owner

mrdoob commented Sep 30, 2011

Merged. Thanks @NINE78! :)

@NINE78
Copy link
Contributor Author

NINE78 commented Sep 30, 2011

My pleasure; I hope others get some use out of this! I mainly use it to recursively traverse a LOD quadtree, and for another object to do some funky stencil buffer stuff...
The frustum is passed along to perform hierarchical frustum checking (first bounding sphere, and then bounding box). I'm considering doing some faster "frustum cone" checking as well.

As said before, I'm not quite sure this is the "cleanest" way of doing it, but since JS doesn't have any proper prototype/interface mechanism, it's the best I could come up with. But I do feel confident there is room in there for a "custom renderer pipeline" much like to ability to have custom shaders...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants